package com.itoken.feign.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONPObject;
import com.itoken.common.dto.BaseResult;
import com.itoken.feign.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by 蔡超 on 2019/1/17.
 */
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping({"","/index"})
    public String index(){
        BaseResult baseResult = userService.login("zhangsan","zhangsan");
        System.out.println("baseResult: " + JSON.toJSONString(baseResult));
        return "index";
    }

    @RequestMapping(value = "hi")
    public String sayHi(@RequestParam(value = "message") String message){
        String str= userService.sayHi(message);
        System.out.println("str: " + str);
        return "index";
    }

}
